package com.nf.health.app.mine.activity;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.nf.health.app.R;
import com.nf.health.app.activity.global.BaseActivity;
import com.nf.health.app.utils.ViewUtil;

/** 
* @ClassName: FeedbackActivity 
* @Description: 反馈页面
* @author Ian 
* @date 2015-11-4 上午9:52:45 
*  
*/
public class FeedbackActivity extends BaseActivity implements OnClickListener {
	private TextView rightTV;
	private Button commit_button;
	private EditText et_content;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setTitleBar(R.layout.titlebar_base);
		setContent(R.layout.activity_feedback);
		ViewUtil.setText(this, R.id.titlebar_title_tv, "意见反馈");
		rightTV = (TextView) findViewById(R.id.titlebar_right_tv);
		commit_button = (Button) findViewById(R.id.commit_button);//提交按钮
		rightTV.setVisibility(View.GONE);
		et_content = (EditText) findViewById(R.id.et_content);

		initListener();
	}
	private void initListener() {
		rightTV.setOnClickListener(this);
		commit_button.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.commit_button:
			if (et_content.getText().toString().length() == 0) {
				showToast("请输入内容");
				return;
			}
			provider.requestFeedback(et_content.getText().toString(),"requestFeedback");
			break;
		default:
			break;
		}
		super.onClick(v);
	}

	@Override
	public void handleActionSuccess(String actionName, Object object) {
		super.handleActionSuccess(actionName, object);
		if ("requestFeedback".equals(actionName)) {
			showToast("提交成功");
			finish();
		}
	}
}
